<?php 
session_start();
if (!isset($_SESSION['user'])) {
	
	header("Location: index.php");
}
function __autoload($class_name) {
	include $class_name.'.php';
}
$currUsername = $_SESSION['user']->getUsername();
$currProfile = new Profile($currUsername);

if(isset($_GET['action']) && $_GET['action'] == "logout") {
	
	Utils::logoutUser();
}

$currentUser = $currProfile->getUser();
if($currentUser->checkIfLocked()) {
	
	header("Location: beerWorld.php");
}
?>
<html>
        <head>
                <meta charset="utf-8">
                <title>Офис войни</title>
                <link href="css/officeStyle.css" rel="stylesheet" type="text/css" />
                <script src="js/jquery-1.11.1.min.js"></script>
                <script src="js/officeJS.js"></script>
        </head>
        <body>
                <div id="headerContainer"><?php OfficeDivs::userMenu($currProfile)?></div>
                <div id="contentContainer">
                        <div id="leftContent">                          
                                <div id="beerContainer">
                                        <a href="office.php?action=beer_disp_active">
                                        <img alt="beer_disp" src="images/beer_disp.png" width="150" height="350" id="beer_disp"
                                        onmouseover="onImageHover(this)" onmouseout="onImageHover(this)">
                                        </a>
                                </div>
                        </div>
                        <div id="middleContent">                                
                                <div id="c1">
                                        <a href="office.php?action=comp_battle_active">
                                                <img alt="comp_battle" src="images/comp_battle.png" id="comp_battle"
                                                onmouseover="onImageHover(this)" onmouseout="onImageHover(this)">
                                        </a>
                                </div>
                                <div id="c2">
                                        <a href="office.php?action=slave_market_active">
                                                <img alt="slave_market" src="images/slave_market.png" id="slave_market" 
                                                onmouseover="onImageHover(this)" onmouseout="onImageHover(this)">
                                        </a>
                                </div>
                                <div id="c3">
                                        <a href="office.php?action=battle_active">
                                                <img alt="battle" src="images/battle.png" id="battle"
                                                onmouseover="onImageHover(this)" onmouseout="onImageHover(this)">
                                        </a>
                                </div>
                        </div>
                        <div id="rightContent">         
                                <div id="emptyPocketsContainer">
                                        <a href="office.php?action=empty_pockets_active">       
                                                <img alt="empty_pockets" src="images/empty_pockets.png" id="empty_pockets"
                                                onmouseover="onImageHover(this)" onmouseout="onImageHover(this)">
                                        </a>
                                </div>
                        </div>
                                <div id="edit_profile_active" class="hidden">
                                <div class="close" id="x"><img class="close" alt="close" src="images/close.png"></div>
                                <?php UserForms::editForm($currProfile, $_POST, $_FILES);?>
                                </div>
                                
                                <div id="profile_active" class="hidden">
                                <div class="close" id="x"><img class="close" alt="close" src="images/close.png"></div>
                                <?php OfficeDivs::profileDiv($currProfile, $_REQUEST);?>
                                </div>
                                <div id="ranklist_active" class="hidden">
                                <div class="close" id="x"><img class="close" alt="close" src="images/close.png"></div>
                                <?php OfficeDivs::ranklistDiv($currProfile, $_REQUEST);?>
                                </div>
                                <div id="beer_disp_active" class="hidden">
                                <div class="close" id="x"><img class="close" alt="close" src="images/close.png"></div>
                                <?php OfficeDivs::beerDispDiv($currProfile, $_REQUEST)?>
                                </div>
                                <div id="slave_market_active" class="hidden">
                                <div class="close" id="x"><img class="close" alt="close" src="images/close.png"></div>
                                <?php OfficeDivs::slaveMarketDiv($currProfile, $_REQUEST)?>
                                </div>
                                <div id="comp_battle_active" class="hidden">
                                <div class="close" id="x"><img class="close" alt="close" src="images/close.png"></div>
                                <?php OfficeDivs::compBattleDiv($currProfile, $_REQUEST)?>
                                </div>
                                <div id="empty_pockets_active" class="hidden">
                                <div class="close" id="x"><img class="close" alt="close" src="images/close.png"></div>
                                <?php OfficeDivs::emptyPocketsDiv($currProfile, $_REQUEST)?>
                                </div>
                                <div id="battle_active" class="hidden">
                                <div class="close" id="x"><img class="close" alt="close" src="images/close.png"></div>
                                <?php OfficeDivs::battleDiv($currProfile, $_REQUEST)?>
                                </div>
                        </div>
                <div id="footerContainer"><?php OfficeDivs::statsMenu($currProfile)?></div>
        </body>
</html>

